package com.cf.common.util.tree;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ChenFeng
 * @date 2021/11/5 11:21 上午
 * @description
 */
@Data
public class BaseNode<T> implements INode<T> {

    private static final long serialVersionUID = 1L;
    @JsonSerialize(
            using = ToStringSerializer.class
    )
    protected Long id;
    @JsonSerialize(
            using = ToStringSerializer.class
    )
    protected Long parentId;
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    protected List<T> children = new ArrayList();
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Boolean hasChildren;

}
